package com.hww.DesignPattern.Singleton;

/**
 * @author:Huangwenwei
 * @date:2014-6-18
 * @time:下午8:41:05
 */
public class SingletonB {
	private int id=1;
	private static SingletonB instance;

	private SingletonB() {
	}

	public synchronized int getId() {
		return id;
	}

	public static synchronized SingletonB getInstance() {
		if (instance == null)
			instance = new SingletonB();
		return instance;
	}

	public synchronized void nextID() {
		id++;
	}
}
